import {getGroup_users} from "@src/api/group"
import base from "@src/store/base";
import {storeBindingsBehavior} from "mobx-miniprogram-bindings";

Component({
  behaviors: [storeBindingsBehavior],
  storeBindings: [
  {
    store: base,
    fields: ['themeColor', 'themeTitleColor'],
  }],

  /**
   * 组件的属性列表
   */
  properties: {

  },
  options: {
    addGlobalClass: true,
  },

  /**
   * 组件的初始数据
   */
  data: {
    groupMemberList:null,
    groupMember_helpList:null,
    usersListStatus:0,//0全部人 1代收款人

  },

  /**
   * 组件生命周期
   */
  lifetimes: {
    attached: function (val) {


    },
    ready: function (val) {


    },
    moved: function () {

    },
    detached: function () {

    },
  },

  /**
 * 组件所在页面生命周期
 */
  pageLifetimes: {

  },

  /**
   * 组件的方法列表
   */
  methods: {
    onLoad(option){
      const params = {
        leaderCollect: true,
        orderNo:option.orderNo ,
        // status: 0
      }
      getGroup_users(params).then(res=>{
        this.setData({groupMemberList:res.data})
        this.handleHelpGoods(res.data)
      })
    },
    handleHelpGoods(list){
      const groupMember_helpList= list.filter((item,index)=>{
         return  item.leaderCollect
        })
      this.setData({groupMember_helpList})
    },
    navClick(e){
      if(e.currentTarget.dataset.status==='all'){
        this.setData({usersListStatus : 0 })
      }else {
        this.setData({usersListStatus : 1 })
      }
    },
    callPhoneFn(e){
      console.log(e)
      wx.makePhoneCall({
        phoneNumber: e.currentTarget.dataset.phonenum //仅为示例，并非真实的电话号码
      })
    }

  }
})
